<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <button v-on:click="addClick">点击+1</button>
        <p>{{this.$store.state.count}}</p>
    </div>
</body>
<script src="./node_modules/vue/dist/vue.js"></script>
<script src="./node_modules/vuex/dist/vuex.js"></script>
<script>

    let store = new Vuex.Store({
        state:{
            count:123,
        },
        mutations:{
            addNum:function(state){
                state.count++;
            },
        },
    });

    let vm = new Vue({
        el:"#app",
        store,
        methods:{
            addClick:function(){
                this.$store.commit("addNum");
            }
        }
    })
</script>
</html>